-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] 좋아요 동시성 이슈 해결 #224
base: develop
Are you sure you want to change the base?
[fix] 좋아요 동시성 이슈 해결 #224
Conversation
import org.hankki.hankkiserver.common.code.ErrorCode; | ||
|
||
@Getter | ||
public class ConcurrencyException extends RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
초반에 exception 유형 에러유형400 401... 등으로 하기로 했었음
굳이 이거 새로 만들 필요 있나 싶어요
@EnableRetry | ||
@Configuration | ||
public class RetryConfig { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
빈 등록하면서 aop 적용순서(transactional이랑 retry) 정해야 하는 거 같기도 하던데 고려된건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
명시적으로 지정해주지 않아도 기본적으로 Spring AOP의 우선순위에 따라 @retryable이 먼저 적용된다고 합니다.
public HeartCreateResponse createHeart(final HeartPostCommand heartPostCommand) { | ||
User user = userFinder.getUserReference(heartPostCommand.userId()); | ||
Store store = storeFinder.findByIdWhereDeletedIsFalse(heartPostCommand.storeId()); | ||
@Retryable( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optimisticlockexception 발생하면 retry시키는건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넹 맞습니다. 다만, noRetryFor을 통해서 재시도 하지 않을 예외들은 제외하였습니다.
@@ -87,4 +108,10 @@ public String getImageUrlOrElseNull() { | |||
public void updateLowestPrice(int lowestPrice) { | |||
this.lowestPrice = lowestPrice; | |||
} | |||
|
|||
private void validateHeartCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BadRequestException이 domain 패키지에 존재하는 클래스에 있는건 적절하지 않은 것 같습니당 차라리 리턴값 boolean 등으로 변경하고 에러는 service 쪽에서 던져주는게 어떨까요?
package org.hankki.hankkiserver.api.store.service.command; | ||
|
||
public record HeartCommand( | ||
Long userId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 필드이 필수 값들이라면 원시타입으로 하면 어떨까요?
Related Issue 📌
close #223
Description ✔️
To Reviewers
테스트코드를 짤 줄 몰라서
curl
명령어로 직접 api 테스트 했습니다.후에 운영 서버로 병합되었을 때, 기존의 식당 정보 중 version 컬럼 값이 null인 것들을 0으로 초기화 하는 작업 필요